package com.example.mindadinner.adapter;


import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

public abstract class MultilateralListViewAdapter extends BaseAdapter {
	private int types;

	protected MultilateralListViewAdapter(int types) {
		this.types = types;
	}

	@Override
	public  View getView(int position, View convertView, ViewGroup parent) {
		Object holder = null;
		int type = getItemViewType(position);
		if (convertView == null) {
			holder = setViewHolder();
			convertView = switchDifTypes(convertView, type, holder);
			convertView.setTag(holder);
		} else {
			holder = convertView.getTag();
		}
		SetDifTypesView(type);
		return convertView;
	}

	public abstract Object setViewHolder();

	public abstract View switchDifTypes(View convertView, int type,
			Object holder);

	public abstract void SetDifTypesView(int type);

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public abstract Object getItem(int position);

	@Override
	public abstract int getCount();

	@Override
	public abstract int getItemViewType(int position);

	@Override
	public int getViewTypeCount() {
		return types;
	}
}
